WEBSERVER_COMPILE_DIR ?= $(error WEBSERVER_COMPILE_DIR environment variable is not set)
WEBSERVER_INSTALL_DIR ?= $(error WEBSERVER_INSTALL_DIR environment variable is not set)

APR_SOURCE = apr-1.7.6.tar.bz2
APR_DIR = apr-1.7.6

.PHONY: all
all: compile install

.PHONY: compile
compile: extract
	cd $(WEBSERVER_COMPILE_DIR)/$(APR_DIR) && \
	./configure --prefix=$(WEBSERVER_INSTALL_DIR) && \
	make

.PHONY: extract
extract:
	tar -xjf $(APR_SOURCE) -C $(WEBSERVER_COMPILE_DIR)

.PHONY: install
install:
	cd $(WEBSERVER_COMPILE_DIR)/$(APR_DIR) && \
	make install